﻿using System.Collections.Generic;
using System.Text;

namespace TLang.Values
{
    public class Vector : Value
    {

        public readonly List<Value> Values;


        public Vector(List<Value> values)
        {
            this.Values = values;
        }


        public void Set(int idx, Value value)
        {
            Values[idx] = value;
        }


        public int Size()
        {
            return Values.Count;
        }


        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(Constants.SQUARE_BEGIN);

            bool first = true;
            foreach (Value v in Values)
            {
                if (!first)
                {
                    sb.Append(" ");
                }
                sb.Append(v);
                first = false;
            }

            sb.Append(Constants.SQUARE_END);

            return sb.ToString();
        }
    }
}
